project(thread)
cmake_minimum_required(VERSION 3.1)
set(CMAKE_BUILD_TYPE "Debug")
add_compile_options(-std=c++17)
# Add the source in project root directory
aux_source_directory(. DIRSRCS)
find_package(glog 0.6.0 REQUIRED)
# Add header file include directories

include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/thread_pool)
include_directories(${PROJECT_SOURCE_DIR}/thread_pool/worker_thread)
include_directories(${PROJECT_SOURCE_DIR}/thread_pool/thread_task)

include_directories(${PROJECT_SOURCE_DIR}/events_base)
include_directories(${PROJECT_SOURCE_DIR}/events_base/events_cb)
include_directories(${PROJECT_SOURCE_DIR}/events_base/events_config)
include_directories(${PROJECT_SOURCE_DIR}/task_cmd/task_query)
include_directories(${PROJECT_SOURCE_DIR}/task_cmd/file_upload)
include_directories(${PROJECT_SOURCE_DIR}/task_cmd/file_download)
include_directories(${PROJECT_SOURCE_DIR}/task_cmd/task_port)

include_directories(${PROJECT_SOURCE_DIR}/task_cmd)
include_directories(${PROJECT_SOURCE_DIR}/mysql_client)

add_subdirectory(${PROJECT_SOURCE_DIR}/mysql_client)

add_subdirectory(${PROJECT_SOURCE_DIR}/task_cmd)
add_subdirectory(${PROJECT_SOURCE_DIR}/task_cmd/task_query)
add_subdirectory(${PROJECT_SOURCE_DIR}/task_cmd/file_upload)
add_subdirectory(${PROJECT_SOURCE_DIR}/task_cmd/file_download)
add_subdirectory(${PROJECT_SOURCE_DIR}/task_cmd/task_port)

add_subdirectory(${PROJECT_SOURCE_DIR}/thread_pool/thread_task)
add_subdirectory(${PROJECT_SOURCE_DIR}/thread_pool/)
add_subdirectory(${PROJECT_SOURCE_DIR}/thread_pool/worker_thread)
add_subdirectory(${PROJECT_SOURCE_DIR}/events_base)
add_subdirectory(${PROJECT_SOURCE_DIR}/events_base/events_cb)
add_subdirectory(${PROJECT_SOURCE_DIR}/events_base/events_config)


#add_subdirectory(${PROJECT_SOURCE_DIR}/)
# Target
#set(${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PROJECT_SOURCE_DIR})

add_executable(${PROJECT_NAME} ${DIRSRCS})
# 编译的前后顺序也有一致性，A链接了B， main.cpp要先链接B，才能链接A，比如就出错

target_link_libraries(${PROJECT_NAME} glog::glog thread_pool worker_thread pthread events_base event 
event_pthreads events_cb events_config task_factory thread_task task_query file_upload file_download task_port mysql_client mysqlclient)
#target_link_libraries(${PROJECT_NAME} glog::glog pthread thread_pool worker_thread)

# target_link_libraries(RRmove )
# 后写的目录要后加进去